package bankeralgorithm

// 初始化测试数据
func InitData() {
	Max = make([][]int, ProcessNum)
	for i := range Max {
		Max[i] = make([]int, ResourcesNum)
	}
	Max[0][0] = 0
	Max[0][1] = 0
	Max[0][2] = 1
	Max[0][3] = 2

	Max[1][0] = 1
	Max[1][1] = 7
	Max[1][2] = 5
	Max[1][3] = 0

	Max[2][0] = 2
	Max[2][1] = 3
	Max[2][2] = 5
	Max[2][3] = 6

	Max[3][0] = 0
	Max[3][1] = 6
	Max[3][2] = 5
	Max[3][3] = 2

	Max[4][0] = 0
	Max[4][1] = 6
	Max[4][2] = 5
	Max[4][3] = 6

	Allocation = make([][]int, ProcessNum)
	for i := range Max {
		Allocation[i] = make([]int, ResourcesNum)
	}
	Allocation[0][0] = 0
	Allocation[0][1] = 0
	Allocation[0][2] = 1
	Allocation[0][3] = 2

	Allocation[1][0] = 1
	Allocation[1][1] = 0
	Allocation[1][2] = 0
	Allocation[1][3] = 0

	Allocation[2][0] = 1
	Allocation[2][1] = 3
	Allocation[2][2] = 5
	Allocation[2][3] = 4

	Allocation[3][0] = 0
	Allocation[3][1] = 6
	Allocation[3][2] = 3
	Allocation[3][3] = 2

	Allocation[4][0] = 0
	Allocation[4][1] = 0
	Allocation[4][2] = 1
	Allocation[4][3] = 4

	Available = make([]int, ResourcesNum)
	Available[0] = 1
	Available[1] = 5
	Available[2] = 2
	Available[3] = 0
}
